package resource.models;

import java.io.Serializable;

public class Terrain  implements Serializable
{
	private final boolean traversable;
	private final boolean sightBlocked;
	private final String name;
	
	public Terrain(String name, boolean traversable, boolean sightBlocked)
	{
		this.name = name;
		this.sightBlocked = sightBlocked;
		this.traversable = traversable;
	}
	
	public Terrain(){
		this.name = "RandomTerrain";
		this.sightBlocked = false;
		this.traversable = true;
	}
	
	public String getName()
	{
		return name;
	}
	
	public boolean isTraversable()
	{
		return traversable;
	}
	
	public boolean isSightBlocked()
	{
		return sightBlocked;
	}
	
	@Override
	public boolean equals(Object obj){
		boolean toReturn = true;
		
		if(obj.getClass().equals(this.getClass())){
			Terrain other = (Terrain) obj;
			
			if(this.sightBlocked != other.sightBlocked ||
					this.traversable != other.traversable ||
					!this.name.equals(other.name)){
				
				toReturn = false;
			}
			
		}else{
			toReturn = false;
		}
		
		return toReturn;
	
	}
}
